# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=dalfox
pkgver=2052.32f1cd2
pkgrel=2
pkgdesc='Parameter Analysis and XSS Scanning tool.'
arch=('x86_64' 'aarch64')
groups=('blackarch' 'blackarch-webapp' 'blackarch-fuzzer')
url='https://github.com/hahwul/dalfox'
license=('MIT')
depends=('glibc')
makedepends=('git' 'go')
source=("git+https://github.com/hahwul/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

build() {
  cd $pkgname

  GOPATH="$srcdir" go mod download
  GOPATH="$srcdir" go build \
    -trimpath \
    -buildmode=pie \
    -mod=readonly \
    -modcacherw \
    -ldflags "-s -w" \
    -o $pkgname .
}

package() {
  cd $pkgname

  install -Dm 755 $pkgname "$pkgdir/usr/bin/$pkgname"
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

